import Axios from 'axios'
import Vue from 'vue'
import { layoutComponents } from '@/views/app-dev/qianDuanZJ/formMaking/componentsConfig.js';
const formLayoutData = JSON.parse(sessionStorage.getItem('formLayoutData'))
const state = {
    // layoutComponents : formLayoutData ? formLayoutData:layoutComponents, // 缓存中间表单数据
    layoutComponents,//不使用缓存
    selectWidget: {}, // fromMaking选中的控件
    configData: {},//控件的配置数据
}

const mutations = {

    // 处理中间表单的数据
    handleFormLayout(state, payload) {
        state.layoutComponents = payload
    },
    // 处理拖拽和选中的控件
    handleSelectWidget(state, payload) {
        let configOptions = {
            components: payload.options,
            control: payload.control.options
        }
        state.selectWidget = payload
        state.configData = configOptions
    },
    // // 处理选中的控件的配置文件
    // handleControlConfig(state, payload) {
    //     console.log(payload)
    // },
}

const actions = {

}

export default {
    state,
    mutations,
    actions
}
